package com.keyware.kd.controller.jurisdiction;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import com.keyware.utils.ProjectIdentNew;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.keyware.kd.context.Token;
import com.keyware.kd.controller.BaseController;
import com.keyware.kd.repository.entity.Menu;
import com.keyware.kd.service.itf.jurisdiction.MenuService;
import com.keyware.kd.service.itf.number.NumberBuilderService;
import com.keyware.kd.task.util.AjaxMessage;
import com.keyware.kd.utils.Constant;
import com.keyware.kd.vo.menu.menuVo;
import com.keyware.utils.JsonUtils;
import com.keyware.utils.PaginationUtil;

/**
 *
 * 此类描述的是：   	授权管理
 * @author: 赵亚舟
 * @version: 2016年6月20日 上午11:14:50
 */
@Controller
@RequestMapping("/jurisdiction")
public class JurisdictionController extends BaseController{

	@Autowired
	private MenuService menuService;

	@Autowired
	private NumberBuilderService numberBuilderService;

	/*@Autowired
	private OrganizeassetsService organizeassetsService;*/

	public static Logger logger = Logger.getLogger(JurisdictionController.class);

	/**
	 *
	 * @Title: menuList
	 * @Description: 授权列表
	 * @return
	 * @return String
	 */
	@RequestMapping(value = "/menuList",method = RequestMethod.GET,produces = "application/json; charset=utf-8")
	public String menuList(String menuId,String projectId,String id,String projectstatus){
		setMenuList(menuId);
		request.setAttribute("projectId", projectId);
		request.setAttribute("id", id);
		request.setAttribute("projectstatus", projectstatus);
		return Constant.projectName+"/portal/home_body";
	}

	private void setMenuList(String menuId) {
		try {
			request.setAttribute("parentMenuId", menuId);
			//KE 组合模型ID
			String groupEId = request.getParameter("groupEId");
			request.setAttribute("groupEId", groupEId);

			String userId = (String) request.getSession().getAttribute("userId");
			String clickNodeId = request.getParameter("clickNodeId");

			Menu selectByPrimaryKey = menuService.selectByPrimaryKey(menuId);
			if(selectByPrimaryKey != null){
				request.setAttribute("menuInfo", selectByPrimaryKey);
			}

			String isSys = "";
			if("sysadmin".equals(getUser_idFormSession("userId")))
				isSys = "sysadmin";

			menuVo menuVo = new menuVo();
			menuVo.setUserId(userId);
			menuVo.setParentId(menuId);
			menuVo.setIsSys(isSys);
			menuVo.setMenuLevel(4L);
			List<menuVo> menuVoLessFourLevelList = menuService.listMenuLessThanLimitLevel(menuVo);
			List<menuVo> removeDuplicate = this.removeDuplicate(menuVoLessFourLevelList);
			if("11111".equals(selectByPrimaryKey.getMenuId()) ||  "22222".equals(selectByPrimaryKey.getMenuId())
					||  "组织资产管理".equals(selectByPrimaryKey.getMenuName()) ||  "系统管理".equals(selectByPrimaryKey.getMenuName())){
				removeDuplicate.clear();
				menuVo.setMenuLevel(null);
				List<menuVo> menuVoMoreThreeLevelList = menuService.listMenuMoreThanLimitLevel(menuVo);
				removeDuplicate.addAll(this.removeDuplicate(menuVoMoreThreeLevelList));
			}
			if (StringUtils.hasText(clickNodeId)){
				request.setAttribute("needExpandNodeId", clickNodeId);
			}else if("11111".equals(selectByPrimaryKey.getMenuId()) || "22222".equals(selectByPrimaryKey.getMenuId())
					||  "组织资产管理".equals(selectByPrimaryKey.getMenuName())){
				request.setAttribute("needExpandNodeId", "zuzhizichan");
			}else  if(removeDuplicate.size() > 0){
				request.setAttribute("needExpandNodeId", removeDuplicate.get(0).getMenuId());
			}
			//如果不是超管 就不显示菜单和权限
			List<menuVo> listMenuVo = new ArrayList<menuVo>();
			if(!"sysadmin".equals(getUser_idFormSession("userId"))){
				for(menuVo menu:removeDuplicate){
					if((!"菜单管理".equals(menu.getName()))
							&&(!"权限管理".equals(menu.getName()))&&(!"KT基础设置".equals(menu.getName()))&&(!"客户标识设置".equals(menu.getName()))&&(!"系统密级设置".equals(menu.getName()))){
						listMenuVo.add(menu);
					}
				}
				request.setAttribute("menuList", JsonUtils.toJson(listMenuVo));
			}else{
				request.setAttribute("menuList", JsonUtils.toJson(removeDuplicate));
			}


		} catch (Exception e) {
			logger.error(e);
		}
	}


	/*
	 * @Title: showOrgTree
	 * @Description: 进入组织资产树页面
	 * @param [menuId, projectId, id, projectstatus]
	 * @author 李军荣
	 * @return java.lang.String
	 */
	@RequestMapping(value = "/showOrgTree",method = RequestMethod.GET,produces = "application/json; charset=utf-8")
	public String showOrgTree(String menuId,String projectId,String id,String projectstatus){
		String numCode = getUser_idFormSession("customCode");
		if(numCode != null && !numCode.equals(ProjectIdentNew.siyuan17suo)){
			setMenuList17suo(menuId);
		}else{
			setMenuList(menuId);
		}
		request.setAttribute("projectId", projectId);
		request.setAttribute("id", id);
		request.setAttribute("projectstatus", projectstatus);
		return Constant.projectName+"/portal/showOrgTree";
	}

	/**
	 *
	 * @Title: menuList
	 * @Description: 授权列表2
	 * @return
	 * @return String
	 */
	@RequestMapping(value = "/menuList2",method = RequestMethod.GET,produces = "application/json; charset=utf-8")
	public String menuList2(String menuId){
		try {
			request.setAttribute("parentMenuId", menuId);
			String userId = (String) request.getSession().getAttribute("userId");
			String clickNodeId = request.getParameter("clickNodeId");

			Menu selectByPrimaryKey = menuService.selectByPrimaryKey(menuId);
			if(selectByPrimaryKey != null){
				request.setAttribute("menuInfo", selectByPrimaryKey);
			}

			String isSys = "";
			if("sysadmin".equals(getUser_idFormSession("userId")))
				isSys = "sysadmin";

			//查询二级权限
			menuVo menuVo = new menuVo();
			menuVo.setUserId(userId);
			menuVo.setParentId(menuId);
			menuVo.setProjectSource(Constant.projectName);
			menuVo.setMenuLevel(4L);
			menuVo.setIsSys(isSys);

			List<menuVo> menuList = menuService.listMenuLessThanLimitLevel(menuVo);
			List<menuVo> removeDuplicate = this.removeDuplicate(menuList);
			/*List<menuVo> twolelve = menuService.getAllTheLevelMenuBasedOnTheAccountID(menuVo);
			List<menuVo> removeDuplicate = this.removeDuplicate(twolelve);
			for(int i=0;i<removeDuplicate.size();i++){
				//查询三级权限
				menuVo vo = removeDuplicate.get(i);
				String id = vo.getMenuId();

				menuVo menuVo2 = new menuVo();
				menuVo2.setUserId(userId);
				menuVo2.setParentId(id);
				List<menuVo> threelevel = menuService.getAllTheLevelMenuBasedOnTheAccountID(menuVo2);
				if(threelevel.size() > 0){
					removeDuplicate.addAll(this.removeDuplicate(threelevel));
				}

			}*/

			if (StringUtils.hasText(clickNodeId)){
				request.setAttribute("needExpandNodeId", clickNodeId);
			}else if("11111".equals(selectByPrimaryKey.getMenuId()) ||  "22222".equals(selectByPrimaryKey.getMenuId())){
				request.setAttribute("needExpandNodeId", "zuzhizichan");
			}else  if(removeDuplicate.size() > 0){
				request.setAttribute("needExpandNodeId", removeDuplicate.get(0).getMenuId());
			}
			request.setAttribute("menuList", JsonUtils.toJson(removeDuplicate));

		} catch (Exception e) {
			logger.error(e);
		}

		return Constant.projectName+"/portal/home_body2";
	}

	/**
	 *
	 * @Title: menuList
	 * @Description: 授权列表2
	 * @return
	 * @return String
	 */
	@RequestMapping(value = "/menuList3",method = RequestMethod.GET,produces = "application/json; charset=utf-8")
	public String menuList3(String menuId){
		setMenuList(menuId);
		return Constant.projectName+"/portal/home_body3";
	}


	/**
	 *
	 * @Title: menuList
	 * @Description: 组织资产引用
	 * @return
	 * @return String
	 */
	@RequestMapping(value = "/organize",method = RequestMethod.GET,produces = "application/json; charset=utf-8")
	@Token(create=true)
	public String organize(){
		try {
			String userId = (String) request.getSession().getAttribute("userId");
			String id = request.getParameter("id") == null ? "" : request.getParameter("id");
			Menu  selectByPrimaryKey =menuService.selectByPrimaryKey(id);
			//String menuId = selectByPrimaryKey.getMenuId();
			String sectionId= request.getParameter("sectionId") == null ? "" : request.getParameter("sectionId");
			request.setAttribute("sectionId", sectionId);
			String source = request.getParameter("source") == null ? "" : request.getParameter("source");
			//source:documentEdit
			request.setAttribute("source", source);
			String setPageSize = request.getParameter("setPageSize") == null ? "" : request.getParameter("setPageSize");
			//setPageSize:50
			request.setAttribute("setPageSize", setPageSize);
			if(selectByPrimaryKey != null){
				request.setAttribute("menuInfo", selectByPrimaryKey);
			}

			String isSys = "";
			if("sysadmin".equals(getUser_idFormSession("userId")))
				isSys = "sysadmin";

			menuVo menuVo = new menuVo();
			menuVo.setUserId(userId);
			menuVo.setMenuId(id);
			menuVo.setIsSys(isSys);
			List<menuVo> menuVoList = menuService.listDepthChildrensMenu(menuVo);
			List<menuVo> removeDuplicate = this.removeDuplicate(menuVoList);

			/*//查询二级权限
			List<menuVo> twolelve = menuService.getTheTwoLevelMenuBasedOnTheAccountID(userId, id ,isSys);
			List<menuVo> removeDuplicate = this.removeDuplicate(twolelve);
			for(int i=0;i<removeDuplicate.size();i++){
				//查询三级权限
				menuVo vo = removeDuplicate.get(i);
				String menuId = vo.getMenuId();
				List<menuVo> threelevel = menuService.getThreeTheLevelMenuBasedOnTheAccountID(userId, menuId);
				if(threelevel.size() > 0){
					removeDuplicate.addAll(this.removeDuplicate(threelevel));
				}
				String numCode = getUser_idFormSession("customCode");
				if(numCode != null && numCode.equals(ProjectIdentNew.tianjin712)){
					if(threelevel.size() > 0){
						for(menuVo menuVoTree : threelevel){
							List<menuVo> fourlevel = menuService.getFourTheLevelMenuBasedOnTheAccountID(userId, menuVoTree.getMenuId());
							if(fourlevel.size() > 0){
								removeDuplicate.addAll(this.removeDuplicate(fourlevel));
								for(menuVo menuVoFour : fourlevel){
									List<menuVo> fivelevel = menuService.getFiveTheLevelMenuBasedOnTheAccountID(userId, menuVoFour.getMenuId());
									if(fivelevel.size() > 0){
										removeDuplicate.addAll(this.removeDuplicate(fivelevel));
										for(menuVo menuVoFive : fivelevel){
											List<menuVo> sixlevel = menuService.getSixTheLevelMenuBasedOnTheAccountID(userId, menuVoFive.getMenuId());
											if(sixlevel.size() > 0){
												removeDuplicate.addAll(this.removeDuplicate(sixlevel));
											}
										}
									}
								}
							}
						}
					}
				}
			}*/
			if(removeDuplicate.size() > 0){
				request.setAttribute("needExpandNodeId", removeDuplicate.get(0).getMenuId());
			}
			request.setAttribute("menuList", JsonUtils.toJson(removeDuplicate));

		} catch (Exception e) {
			logger.error(e);
		}
		return Constant.projectName+"/documentEdit/referOrganrize";
	}

	/**
	 *
	 *	@Title 判断是否有组织资产菜单权限
	 *  @author 李涛
	 *  @param
	 *  @date   2016年10月28日
	 *  @return AjaxMessage
	 */
	@RequestMapping(value="/judgeOrganize",method = RequestMethod.POST,produces = "application/json; charset=utf-8")
	@ResponseBody
	public  AjaxMessage judgeOrganize(){
		AjaxMessage ajaxMessage = new AjaxMessage();
		String userId = (String) request.getSession().getAttribute("userId");
		String menuId = request.getParameter("id") == null ? "" : request.getParameter("id");
		Menu selectByPrimaryKey = menuService.selectByPrimaryKey(menuId);
		String sectionId= request.getParameter("sectionId") == null ? "" : request.getParameter("sectionId");
		request.setAttribute("sectionId", sectionId);
		if(selectByPrimaryKey != null){
			request.setAttribute("menuInfo", selectByPrimaryKey);
		}

		String isSys = "";
		if("sysadmin".equals(getUser_idFormSession("userId")))
			isSys = "sysadmin";

		menuVo menuVo = new menuVo();
		menuVo.setUserId(userId);
		menuVo.setMenuId(menuId);
		menuVo.setIsSys(isSys);
		List<menuVo> menuVoList = menuService.listDepthChildrensMenu(menuVo);
		List<menuVo> removeDuplicate = this.removeDuplicate(menuVoList);
		/*//查询二级权限
		List<menuVo> twolelve = menuService.getTheTwoLevelMenuBasedOnTheAccountID(userId, menuId,isSys);
		List<menuVo> removeDuplicate = this.removeDuplicate(twolelve);
		for(int i=0;i<removeDuplicate.size();i++){
			//查询三级权限
			menuVo vo = removeDuplicate.get(i);
			String id = vo.getMenuId();
			List<menuVo> threelevel = menuService.getThreeTheLevelMenuBasedOnTheAccountID(userId, id);
			if(threelevel.size() > 0){
				removeDuplicate.addAll(this.removeDuplicate(threelevel));
			}

		}*/
		if(removeDuplicate.size()>0){
			ajaxMessage.setCode("1");
		}else{
			ajaxMessage.setCode("0");
		}
		return ajaxMessage;
	}



	/**
	 *
	 * @author: 赵亚舟
	 * @Title: removeDuplicate
	 * @Description: List  去重
	 * @param list
	 * @return
	 * @return List<Menu>
	 */
	private List<menuVo> removeDuplicate(List<menuVo> list) {
		List<menuVo> newList = new ArrayList<menuVo>();
		if (list != null) {
			Set<menuVo> set = new HashSet<menuVo>();
			for (Iterator<menuVo> iter = list.iterator(); iter.hasNext(); ) {
				menuVo element = (menuVo) iter.next();
				if (set.add(element))
					newList.add(element);
			}
		}
		return newList;
	}
	/**
	 *
	 * @Title: getThreeLevel
	 * @Description: 获得三级权限列表
	 * @return
	 * @return String
	 */
	@RequestMapping(value = "/getThreeLevel",produces = "application/json; charset=utf-8")
	@ResponseBody
	public PaginationUtil getThreeLevel(){
		String menuId = request.getParameter("menuId") == null ? "" : request.getParameter("menuId");
		String userId = (String) request.getSession().getAttribute("userId");
		PaginationUtil paginationUtil = new PaginationUtil();
		paginationUtil.before(request);

		menuVo menuVo = new menuVo();
		menuVo.setUserId(userId);
		menuVo.setMenuId(menuId);
		menuVo.setMenuLevel(3L);
		List<menuVo> threelevelList = menuService.listSingleLevelMenu(menuVo);
		//List<menuVo> threelevelList = menuService.getThreeTheLevelMenuBasedOnTheAccountID(userId, menuId);
		paginationUtil.after(threelevelList);
		return paginationUtil;
	}



	@RequestMapping(value = "/menuTreeList",method = RequestMethod.POST,produces = "application/json; charset=utf-8")
	@ResponseBody
	public AjaxMessage menuTreeList(String menuId){
		AjaxMessage ajaxMessage = new AjaxMessage();
		try {
			String userId = (String) request.getSession().getAttribute("userId");


			String isSys = "";
			if("sysadmin".equals(getUser_idFormSession("userId")))
				isSys = "sysadmin";

			String numCode = getUser_idFormSession("customCode");
			Menu menu = menuService.selectByPrimaryKey(menuId);
			//查询二级权限

			menuVo queryMenuVo = new menuVo();
			queryMenuVo.setUserId(userId);
			queryMenuVo.setMenuId(menuId);
			queryMenuVo.setIsSys(isSys);
			queryMenuVo.setMenuLevel(4L);
			queryMenuVo.setProjectSource(Constant.projectName);
			List<menuVo> menuVoLessFourLevelVoList = menuService.listMenuLessThanLimitLevel(queryMenuVo);
			/*List<menuVo> twolelve = menuService.getTheTwoLevelMenuBasedOnTheAccountID(userId, menuId,isSys);

			List<menuVo> removeDuplicate = this.removeDuplicate(twolelve);
			for(int i=0;i<removeDuplicate.size();i++){
				//查询三级权限
				menuVo vo = removeDuplicate.get(i);
				String id = vo.getMenuId();

				queryMenuVo.setMenuId(id);
				queryMenuVo.setMenuLevel(3L);
				List<menuVo> threelevel = menuService.listSingleLevelMenu(queryMenuVo);
				//List<menuVo> threelevel = menuService.getThreeTheLevelMenuBasedOnTheAccountID(userId, id);

				if(threelevel.size() > 0){
					removeDuplicate.addAll(this.removeDuplicate(threelevel));
				}*/
			List<menuVo> removeDuplicate = this.removeDuplicate(menuVoLessFourLevelVoList);
			if(numCode != null && numCode.equals(ProjectIdentNew.tianjin712)){
				if(null != menu && menu.getMenuName().equals("组织资产")){
					/*if(threelevel.size() > 0){
						for(menuVo menuVoTree : threelevel){

							queryMenuVo.setMenuId(menuVoTree.getMenuId());
							List<menuVo> menuVoList = menuService.listDepthChildrensMenu(queryMenuVo);
							removeDuplicate.addAll(this.removeDuplicate(menuVoList));
							List<menuVo> fourlevel = menuService.getFourTheLevelMenuBasedOnTheAccountID(userId, menuVoTree.getMenuId());
							if(fourlevel.size() > 0){
								removeDuplicate.addAll(this.removeDuplicate(fourlevel));
								for(menuVo menuVoFour : fourlevel){
									List<menuVo> fivelevel = menuService.getFiveTheLevelMenuBasedOnTheAccountID(userId, menuVoFour.getMenuId());
									if(fivelevel.size() > 0){
										removeDuplicate.addAll(this.removeDuplicate(fivelevel));
										for(menuVo menuVoFive : fivelevel){
											List<menuVo> sixlevel = menuService.getSixTheLevelMenuBasedOnTheAccountID(userId, menuVoFive.getMenuId());
											if(sixlevel.size() > 0){
												removeDuplicate.addAll(this.removeDuplicate(sixlevel));
											}
										}
									}
								}
							}
						}
					}*/

					queryMenuVo.setMenuLevel(3L);
					List<menuVo> menuVoMoreThreeLevelList = menuService.listMenuMoreThanLimitLevel(queryMenuVo);
					removeDuplicate.addAll(this.removeDuplicate(menuVoMoreThreeLevelList));
				}
			}
			/*}*/

			ajaxMessage.setToken(menuId);
			ajaxMessage.setCode("1");
			ajaxMessage.setMessage("添加成功");
			ajaxMessage.setData(JsonUtils.toJson(removeDuplicate));
		} catch (Exception e) {
			logger.error(e);
			ajaxMessage.setCode("0");
			ajaxMessage.setMessage("系统错误");
		}

		return ajaxMessage;
	}

	private void setMenuList17suo(String menuId) {
		try {
			request.setAttribute("parentMenuId", menuId);
			//KE 组合模型ID
			String groupEId = request.getParameter("groupEId");
			request.setAttribute("groupEId", groupEId);

			String userId = (String) request.getSession().getAttribute("userId");
			String clickNodeId = request.getParameter("clickNodeId");

			Menu selectByPrimaryKey = menuService.selectByPrimaryKey(menuId);
			if(selectByPrimaryKey != null){
				request.setAttribute("menuInfo", selectByPrimaryKey);
			}

			String isSys = "";
			if("sysadmin".equals(getUser_idFormSession("userId")))
				isSys = "sysadmin";


			menuVo menuVo = new menuVo();
			menuVo.setUserId(userId);
			menuVo.setParentId(menuId);
			menuVo.setIsSys(isSys);
			menuVo.setProjectSource(Constant.projectName);
			//menuVo.setMenuLevel(4L);
			menuVo.setSeventeenSuo(true);
			List<menuVo> menuVoLessFourLevelList = menuService.listMenuLessThanLimitLevel(menuVo);
			List<menuVo> removeDuplicate = this.removeDuplicate(menuVoLessFourLevelList);

			/*//查询二级权限
			menuVo menuVo = new menuVo();
			menuVo.setUserId(userId);
			menuVo.setParentId(menuId);
			menuVo.setIsSys(isSys);
			List<menuVo> twolelve = menuService.getAllTheLevelMenuBasedOnTheAccountID17suo(menuVo);


			List<menuVo> removeDuplicate = this.removeDuplicate(twolelve);
			for(int i=0;i<removeDuplicate.size();i++){
				//查询三级权限
				menuVo vo = removeDuplicate.get(i);
				String id = vo.getMenuId();

				menuVo menuVo2 = new menuVo();
				menuVo2.setUserId(userId);
				menuVo2.setParentId(id);
				if ("sysadmin".equals(getUser_idFormSession("userId"))) {
			    menuVo2.setIsSys("sysadmin");
			    }
				List<menuVo> threelevel = menuService.getAllTheLevelMenuBasedOnTheAccountID17suo(menuVo2);
				if(threelevel.size() > 0){
					removeDuplicate.addAll(this.removeDuplicate(threelevel));
				}*/
			if("11111".equals(selectByPrimaryKey.getMenuId()) ||  "22222".equals(selectByPrimaryKey.getMenuId())){
				/*if(threelevel.size() > 0){
					for(menuVo menuVoThree : threelevel){
						menuVo menuVo3 = new menuVo();
						menuVo3.setUserId(userId);
						menuVo3.setParentId(menuVoThree.getMenuId());
						List<menuVo> fourlevel = menuService.getAllTheLevelMenuBasedOnTheAccountID17suo(menuVo3);
						if(fourlevel.size() > 0){
							removeDuplicate.addAll(this.removeDuplicate(fourlevel));
							for(menuVo menuVoFour : fourlevel){
								menuVo menuVo4 = new menuVo();
								menuVo4.setUserId(userId);
								menuVo4.setParentId(menuVoFour.getMenuId());
								List<menuVo> fivelevel = menuService.getAllTheLevelMenuBasedOnTheAccountID17suo(menuVo4);
								if(fivelevel.size() > 0){
									removeDuplicate.addAll(this.removeDuplicate(fivelevel));
									for(menuVo menuVoFive : fivelevel){
										menuVo menuVo5 = new menuVo();
										menuVo5.setUserId(userId);
										menuVo5.setParentId(menuVoFive.getMenuId());
										List<menuVo> sixlevel = menuService.getAllTheLevelMenuBasedOnTheAccountID17suo(menuVo5);
										if(sixlevel.size() > 0){
											removeDuplicate.addAll(this.removeDuplicate(sixlevel));
										}
									}
								}
							}
						}
					}
				}*/
				menuVo.setMenuLevel(3L);
				List<menuVo> menuVoMoreThreeLevelList = menuService.listMenuMoreThanLimitLevel(menuVo);
				removeDuplicate.addAll(this.removeDuplicate(menuVoMoreThreeLevelList));
			}
			/*}*/

			if (StringUtils.hasText(clickNodeId)){
				request.setAttribute("needExpandNodeId", clickNodeId);
			}else if("11111".equals(selectByPrimaryKey.getMenuId()) ||  "22222".equals(selectByPrimaryKey.getMenuId())){
				request.setAttribute("needExpandNodeId", "zuzhizichan");
			}else  if(removeDuplicate.size() > 0){
				request.setAttribute("needExpandNodeId", removeDuplicate.get(0).getMenuId());
			}
			request.setAttribute("menuList", JsonUtils.toJson(removeDuplicate));

		} catch (Exception e) {
			logger.error(e);
		}
	}
}
